//Shirasu Azusa 2024.6
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x)  {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x)  {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x)  {return (x==0?-1:__builtin_ctzll(x));}

#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;  
typedef vector<int> vi;
typedef vector<pii> vp;
typedef tuple<int,int,int> tiii;
int read() {
  int x=0,w=1; char c=getchar(); 
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();} 
  return x*w;
}

const int N=1e6+5,M=1005,B=500;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int n,c[M][M],a[N],lx,ly,rx,ry,cx,cy,fx[N],fy[N];
char s[N];
char col[4]={'*','R','G','B'};
int id[130];

int gg[4][9]={
  {1,2,3,2,3,1,3,1,2},
  {1,2,3,2,3,1,3,1,2},
  {3,2,1,1,3,2,2,1,3},
  {3,2,1,1,3,2,2,1,3}
};
int hh[4][9]={
  {1,2,3,1,2,3,1,2,3},
  {1,2,3,1,2,3,1,2,3},
  {3,2,1,3,2,1,3,2,1},
  {3,2,1,3,2,1,3,2,1}
};
int pp[4][9];

int gec(int x,int y,int d[4][9]) {
  x=((x-B)%4+4)%4;
  y=((y-B)%9+9)%9;
  int z=(d[x][y]+a[1]+2)%3;
  if(z==0) z=3;
  return z;
}

int work(int D[4][9]) {
  lx=ly=rx=ry=cx=cy=B; fx[1]=fy[1]=B;
  c[B][B]=a[1];
  rep(i,2,n) {
    int px=-1,py=-1;
    static int p[4]; rep(i,0,3) p[i]=i;
    if(cx-lx>rx-cx) swap(p[0],p[2]);
    if(cy-ly>ry-cy) swap(p[1],p[3]);
    if(rx-lx>ry-ly) swap(p[0],p[1]), swap(p[2],p[3]);
    bool flag=0;
    rep(d,0,3) {
      int nx=cx+dx[p[d]];
      int ny=cy+dy[p[d]];
      if(gec(nx,ny,D)==a[i]) {
        cx=nx, cy=ny; flag=1;
        break;
      }
    }
    assert(flag);
    fx[i]=cx, fy[i]=cy;
    chmin(lx,fx[i]), chmax(rx,fx[i]);
    chmin(ly,fy[i]), chmax(ry,fy[i]);
  } return max(rx-lx,ry-ly);
}

signed main() {
  freopen("snake.in","r",stdin);
  freopen("snake.out","w",stdout);

  rep(i,0,3) rep(j,0,8) {
    if(gg[i][j]==1) pp[i][j]=1;
    else pp[i][j]=5-gg[i][j];
  }

  scanf("%s",s+1); n=strlen(s+1);
  id['R']=1, id['G']=2, id['B']=3;
  rep(i,1,n) a[i]=id[s[i]];

  int workg=work(gg); int workh=work(hh); int workp=work(pp);
  if(workg<workp||workh<workp) {
    if(workg<workh) swap(gg,pp);
    else swap(hh,pp);
    work(pp);
  }

  rep(i,1,n) assert(gec(fx[i],fy[i],pp)==a[i]);
  rep(i,1,n) c[fx[i]][fy[i]]=1;
  rep(i,1,n) fx[i]-=lx-1;
  rep(i,1,n) fy[i]-=ly-1;
  printf("%d %d\n",rx-lx+1,ry-ly+1);
  rep(i,lx,rx) {
    rep(j,ly,ry) {
      putchar(col[gec(i,j,pp)]);
    } puts("");
  }
  printf("%d %d\n",fx[1],fy[1]);
  rep(i,2,n) {
    if(fx[i]==fx[i-1]) {
      if(fy[i]==fy[i-1]+1) putchar('R');
      else putchar('L'); 
    } else {
      if(fx[i]==fx[i-1]+1) putchar('D');
      else putchar('U');
    }
  } puts("");
  return 0;
}